﻿#region Original Work By Marcelo Chavez
//---------------------------------------------------------------------------------------------------
//
//  This library is based on original work by Marcelo Chavez.
//  Please see http://www.codeproject.com/KB/miscctrl/lcars_net_controls.aspx
//  for more information.
//
//---------------------------------------------------------------------------------------------------
#endregion

using System.Runtime.InteropServices;

namespace Streambolics.Lcars
{
    public class SoundThread
    {
        // Fields
        private string file;
        private bool loop;

        // Methods
        public SoundThread (string file, bool loop)
        {
            this.file = file;
            this.loop = loop;
        }

        public void Play ()
        {
            do
            {
                try
                {
                    PlaySound (this.file, 0L, 0L);
                }
                catch
                {
                }
            }
            while (this.loop);
        }

        [DllImport ("winmm.dll")]
        private static extern long PlaySound (string lpszName, long hModule, long dwFlags);
    }

}